var o = getApp();

Page({
    data: {
        language: "",
        show_num: "",
        store_id: ""
    },
    onLoad: function(o) {
        o.store_id && this.setData({
            store_id: o.store_id
        }), this.getStoreInfo();
    },
    add: function() {
        wx.navigateTo({
            url: "/packageD/o2o/recommendlist/recommendlist?store_id=" + this.data.store_id
        });
    },
    deltap: function(o) {
        console.log(o.currentTarget.id);
        var t = o.currentTarget.id;
        this.deltapInfo(t);
    },
    onReady: function() {
        var o = wx.getStorageSync("langIndex");
        this.setData({
            language: o.en
        });
    },
    onShow: function() {
        this.getStoreInfo();
    },
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {},
    onShareAppMessage: function() {},
    getStoreInfo: function() {
        var t = this, n = o.getNetAddresss("plugin.store-cashier.frontend.store.near-by-goods.get-store-goods");
        o._postNetWork({
            url: n,
            data: {
                store_id: t.data.store_id
            },
            success: function(o) {
                var n = o.data;
                console.log(n), 1 == n.result ? t.setData({
                    list: n.data.list,
                    show_num: n.data.show_num
                }) : wx.showToast({
                    icon: "none",
                    title: n.msg,
                    duration: 1500
                });
            },
            fail: function(o) {
                console.log(o);
            }
        });
    },
    deltapInfo: function(t) {
        var n = this, e = o.getNetAddresss("plugin.nearby-store-goods.frontend.controllers.goods.delete-good");
        o._postNetWork({
            url: e,
            data: {
                store_id: n.data.store_id,
                goods_id: t
            },
            success: function(o) {
                var t = o.data;
                1 == t.result ? wx.showToast({
                    icon: "none",
                    title: t.msg,
                    duration: 1500,
                    success: function() {
                        n.getStoreInfo();
                    }
                }) : wx.showToast({
                    icon: "none",
                    title: t.msg,
                    duration: 1500
                });
            },
            fail: function(o) {
                console.log(o);
            }
        });
    }
});